<%-- 
    Document   : v
    Created on : Oct 30, 2009, 4:37:46 PM
    Author     : Phong
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="DAOClass.*,java.sql.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <script language="JavaScript">
        function process()  {
            document.voteForm.action = "include/voteResult.jsp";
            document.voteForm.submit();
        }
    </script>
    <body>
        <%



            vote objV = new vote();
            ResultSet resultVote = null;
            ResultSet resultSelect = null;
            String nameVote = "";
            int idV = 0;
            resultVote = objV.selectVote();


            if (resultVote.next()) {
                nameVote = resultVote.getString("VoteName");
                idV = resultVote.getInt("VoteID");
                resultSelect = objV.voteSelect(idV);
                //out.println(idV);
            } else {
                response.sendRedirect("index.jsp");
            }
        %>


        <form name="voteForm" action="include/voteResult.jsp">

            <table width="100%" cellspacing="2" class="tblVote">
                <thead>
                    <tr>
                        <th align="left"><input type="hidden" name="voteID" value="<%=idV%>" />
                            <input type="hidden" name="VoteName" value="<%=nameVote%>" />
                            <%=nameVote%>
                            </th>
                    </tr>
                </thead>
                <tbody>
                    <%
                while (resultSelect.next()) {
                    %>

                    <tr>
                        <td>
                            <input type="radio" name="VoteSelect" value="<%=resultSelect.getInt("SelectID")%>" />
                            <%=resultSelect.getString("VoteSelect")%>
                        </td>
                    </tr>

                    <%            }
                    %>
                    <tr>
                        <td>
                            <input type="submit" value=" --OK--" name="ok" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </form>
    </body>
</html>
